#ifndef NOSAL_CORE_EXCEPTIONS_H
#define NOSAL_CORE_EXCEPTIONS_H

#include "nosal/core/error_code.h"

#include <exception>
#include <system_error>
#include <utility>
#include <ostream>

namespace netaos {
namespace nosal {
namespace core {

class Exception : public std::exception
{
    ErrorCode const mErrorCode;

public:
    explicit Exception(ErrorCode err) noexcept
        : mErrorCode(std::move(err))
    { }

    ErrorCode const& Error() const noexcept
    {
        return mErrorCode;
    }

    char const* what() const noexcept override
    {
        return std::exception::what();
    }

protected:
    Exception& operator=(Exception const& other) = default;
};

}  // namespace core
}  // namespace nosal
}  // namespace netaos

#endif  // NOSAL_CORE_EXCEPTIONS_H
